﻿@{
    Layout = null;
}
@*待处理退货状态*@
<style>
    .form-horizontal .form-group {
        margin-bottom: 20px;
    }
</style>
<div class="form-horizontal">
    <div class="form-group">
        <label class="col-sm-4 control-label">收货经销商片区：</label>
        <div class="col-sm-8">
            @Html.DropDownList("SaleAreaId", null, new { @class = "form-control", id = "SaleAreaId" })
        </div>
    </div>
  
    <div class="form-group">
        <label class="col-sm-4 control-label">经销商：</label>
        <div class="col-sm-8">

            <select id="Distributor" class="form-control" name="Distributor" data-live-search="true" data-actions-box="true"></select>
        </div>
    </div>
    </div>
<script>
    Distributor();
    $("#SaleAreaId").change(function () {
        Distributor();
    });
    function Distributor(disId) {

        $("#Distributor").empty();
        $.ajax({
            type: "POST",
            url: "/FleeGoods/SelDistributorList",
            //  data: { SaleAreaId: $("#SaleAreaId").val(), disId: $("#DisId").val() },
            data: { SaleAreaId: $("#SaleAreaId").val(), disId: 0 },
            success: function (data) {

                $.each(data, function (i, item) {
                    if (item["Selected"] == true) {
                        $("<option></option>").val(item["Value"]).text(item["Text"]).attr("selected", "selected").appendTo($("#Distributor"))
                    }
                    else $("<option></option>").val(item["Value"]).text(item["Text"]).appendTo($("#Distributor"));
                })
            }
        });

    }
    //function Distributor() {
    //    $("#Distributor").empty();
    //    $.getJSON(
    //    "/FleeGoods/SelDistributorList",
    //    { SaleAreaId: $("#SaleAreaId").val(), disId: 0 },
    //    function (data) {
    //        $.each(data, function (i, item) {
    //            $("<option></option>").val(item["Value"]).text(item["Text"]).appendTo($("#Distributor"));

    //        })
    //    });
    //}
</script>
